<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="/themes/admin/assets/css/layui.css">
    <script src="/themes/admin/assets/layui.js"></script>
  <script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
</head>
<body>
<table class="layui-table">
    <colgroup>
        <col width="150">
        <col width="200">
        <col>
    </colgroup>
    <thead>
    <tr>
        <th>ID</th>
        <th>用户组</th>
        <th>状态</th>
        <th>管理</th>
    </tr>
    </thead>
    <tbody>
    {volist name="groupList" id="vo"}
    <tr>
        <td>{$vo.id}</td>
        <td>{$vo.title}</td>
        <td>{$vo.status}</td>
        <td>
            <a href="/admin/user/ruleDetail?id={$vo.id}" class="layui-btn layui-btn-normal">编辑</a>
            <button type="button" onclick="delGroup('{$vo.id}',this)" class="layui-btn  layui-btn-danger">删除</button>
        </td>
    </tr>
    {/volist}
    </tbody>
</table>
  <script>
    layui.use("layer");
  var delGroup = function(id,obj){
    layer.confirm('确定删除该用户组？', {
        btn: ['确定','取消'] //按钮
      }, function(){
      
      $.ajax({
        type:"POST",
        data:{id:id},
        url:"/admin/user/delGroup",
        success:function(e){
        if(e.code == 1){
          $(obj).parents("tr").remove();
          layer.msg(e.msg, {icon: 1});	
        }else{
           layer.msg(e.msg, {icon: 5});
        }
        }
      })
      });
    }
  </script>
</body>
</html>